import axios from "axios";


export interface PopularRecord {
    key: number;
    clickNumber: string;
    title: string;
    increases: number;
}
export interface PolicyRecord {
    id: number;
    name: string;
    material: number;
    process_type: number;
    external_price:number;
    stock: number;
    book_stock: number;
    cost_price: number;
    buy_address: string;
    create_time: string;
    is_aftersale_part: number;
    cat_name: string;
    cat_second_name: string;
}

export interface PolicyParams extends Partial<PolicyRecord> {
    current: number;
    pageSize: number;
    selected:number;

}
export interface Pagination {
    current: number;
    pageSize: number;
    total?: number;
    selected:number;
}

export function getAllPartList() {
    return axios.get<any>('/admin/part_cat/tree');
}
export function addPartCat(data:any) {
    return axios.post<any>('/admin/part_cat/add',data);
}
export function queryPartList(data:any) {


    return axios.get<any>(`/admin/part/list?page=${data.page}&page_size=${data.page_size}&part_cat_id=${data.part_cat_id}&part_cat_second_id=${data.part_cat_second_id}`);
}


export function addPartInfo(data:any) {
    return axios.post<any>('/admin/part/add',data);
}
export function partAddNumber(data:any) {
    return axios.post<any>('/admin/part/modify_stock',data);
}
export function delPartInfo(data:any) {
    return axios.post<any>('/admin/part/del',data);
}

export function editPartCat(data:any) {
    return axios.post<any>('/admin/part_cat/edit',data);
}
export function deletePartCat(data:any) {
    return axios.post<any>('/admin/part_cat/del',data);
}
export function editPartInfo(data:any) {
    return axios.post<any>('/admin/part/edit',data);
}


export function addCount(data:any) {
    return axios.post<any>('/admin/part/stock',data);
}

export function delCount(data:any) {
    return axios.post<any>('/admin/module_part/del',data);
}